/****** Object:  UserDefinedFunction [dbo].[fn_ObtenerIdProcurador]    Script Date: 03/12/2013 20:34:15 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

IF(EXISTS(SELECT * FROM sysobjects WHERE xtype = 'FN' AND NAME = 'fn_ObtenerIdProcurador'))
BEGIN
	DROP FUNCTION fn_ObtenerIdProcurador
END
GO


CREATE FUNCTION [dbo].[fn_ObtenerIdProcurador]
(
	@Operador VARCHAR(50)
)
RETURNS int
AS
BEGIN
	DECLARE @retValue AS INT

	SELECT @retValue = id
	FROM NuevoSitio.dbo.accesos 
	WHERE cd_operador = @Operador 

	RETURN @retValue

END


GO

